﻿Public Class NestedGridWidthHackConverter
    Inherits Markup.MarkupExtension
    Implements IValueConverter

    Public Sub New()
    End Sub

    Private Shared mConverter As NestedGridWidthHackConverter
    Public Overrides Function ProvideValue(serviceProvider As IServiceProvider) As Object
        If mConverter Is Nothing Then
            mConverter = New NestedGridWidthHackConverter
        End If
        Return mConverter
    End Function

    Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.Convert
        Dim width As Integer = CInt(value)
        Return width - 20
    End Function

    Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
        Throw New NotImplementedException
    End Function
End Class
